package com.ycsj.goldmedalnewconcept.master.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ycsj.common.utils.UiUtils;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.master.activity.MaseterStudentDataDetailsActivity;
import com.ycsj.goldmedalnewconcept.master.bean.StDataInfo;

import java.util.List;

/**
 * 学生数据列表适配器
 * Created by Administrator on 2019/4/15 0015.
 */

public class StDataRvAdapter extends BaseQuickAdapter<StDataInfo, BaseViewHolder> {

    private Context context;

    public StDataRvAdapter(Context context, int layoutResId, @Nullable List<StDataInfo> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, StDataInfo item) {

        LinearLayout llOut = helper.getView(R.id.ll_out);
        llOut.setBackgroundResource(R.drawable.ll_rv_st_data_bg);

        //排名
        TextView tvPm = helper.getView(R.id.tv_pm);
        tvPm.setText(helper.getLayoutPosition() + "");

        //姓名
        TextView tvXm = helper.getView(R.id.tv_xm);

        //新增
        TextView tvXz = helper.getView(R.id.tv_xz);


        //流失
        TextView tvLs = helper.getView(R.id.tv_ls);

        //备注(详情)
        TextView tvBz = helper.getView(R.id.tv_bz);
        tvBz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到数据界面
                UiUtils.startActivity(context, MaseterStudentDataDetailsActivity.class);
            }
        });

    }
}
